package fr.toto.menuitem;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.nio.file.Path;

import javax.swing.JMenuItem;

import com.kokotchy.betaSeriesAPI.model.Episode;

import fr.toto.constantes.Constantes;
import fr.toto.files.AccesFile;

public class OpenDirMenuItem extends JMenuItem implements Constantes {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4280206959179628646L;
	Episode ep = null;

	public OpenDirMenuItem(Episode e) {
		super(MESSAGES.getString("OpenDirMI"));
		this.ep = e;

		this.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				Path file = AccesFile.Find(ep);
				AccesFile.Open(file.getParent());
			}
		});
	}
}
